<!-- 事例 -->
<template>
  <div>
    <file-management v-loading="loading" element-loading-text="数据加载中" element-loading-background="rgba(0, 0, 0, 0.5)"
      ref="fileMange" :file_table_data="file_table_data" @getFileList="getFileList">
    </file-management>
  </div>
</template>
<script type="text/javascript">
  import fileManagement from '../page/fileManagement/fileManagement.vue'
  export default {
    components: {
      fileManagement
    },
    data() {
      return {
        loading: false,
        file_table_data: []
      };
    },
    watch: {},
    computed: {
      //显示弹框类型
      modalStatus() {
        return this.$store.state.modalStatus;
      },
    },
    props: {
      flagindex: {
        type: Number,
        default: 1
      }
    },
    created() {},
    mounted() {

    },

    methods: {
      // 获取文件夹列表
      getFileList(ob) {
        // console.log(ob)
        this.loading = true;
        let params = ob.params;
        let allparams = {
          params: params,
          api: 'fileMangement',
        }
        this.$store
          .dispatch("getmsgData", allparams)
          .then(response => {
            this.loading = false;
            let res = response.data;
            this.$refs.fileMange.aftergetFileList(ob, res)
          })
          .catch(err => {
            this.loading = false;
            console.log(err);
            this.$message.error("网络连接错误" + "foldermanage");
          });
      },


      //批量删除文件
      handleDel(params) {
        this.loading = true
        let allparams = {
          params: params,
          api: 'deletefileArr',
          method: "post",
        }
        this.$store
          .dispatch("editmsgData", allparams)
          .then(response => {
            this.loading = false;
            let res = response.data;
            this.$message({
              message: "删除成功",
              type: "success"
            });
            this.$refs.fileMange.aftergetFileList({
              op_type: "delete"
            }, res)
          })
          .catch(err => {
            this.loading = false;
            console.log(err);
            this.$message.error("网络连接错误" + "deletefileArr");
          });
      },


    }
  };

</script>
<style scoped></style>
